<template>
  <div id="app">
    <!--左侧导航-->
        <leftNav></leftNav>
    <!--操作区域-->
    <div class="main">
      <router-view></router-view>
    </div>
  </div>
</template>
 
<script>
import leftNav from '@/components/common/leftNav'
export default {
  name: 'app',
  components:{
    leftNav
  },
  methods:{
    /**
   * 获取cas登陆后token
   */
    getToken(url){
      let arr = url.split("?");
      if(arr[1]!=null && arr[1]!=''){
        let arr2 = arr[1].split("=");
        return arr2[1];
      }
      return null;
    },
    toCasLogin(){
      let token_ = this.getToken(window.location.href);
      if(token_!=null){
        casLogin({token:token_}).then(res =>{
          s.set('token', res.data.result.token);
          this.$store.dispatch('setMenu', res.data.result.userData);
          s.set('index', 0);
          let url = res.data.result.userData.modules.DEFAULT_URL;
          location.replace(window.location.href.split("?")[0]);
        });
      }else{
        window.location.href="http://localhost:8088";
      }
    }
  }
}
</script>
 
<style>
#app {
  font-family: 'Microsoft YaHei','Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: left;
  color: #2c3e50;
   height:100%;
}
 
.main{
  float:left;
  width:100%; 
  background-color: #EFF2F7;
  height:90%;
  overflow: auto;
 
}
</style>